using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml.Serialization;

namespace DbService
{
   /// <summary>
   /// Summary description for QueueManager
   /// </summary>
   [WebService(Namespace = "http://localhost")]
   [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
   [ToolboxItem(false)]
   public class QueueManager : System.Web.Services.WebService
   {
      [WebMethod]
      [return: XmlElement(typeof(Transactie))]
      public ArrayList GetTransactionQueue()
      {
         Array tmp = TransactieQueue.Instance.ToArray();                  
         return ArrayList.Adapter(tmp);
      }

      [WebMethod]
      public bool RemoveItemFromQueue(int factuurId)
      {
         Transactie transactie = TransactieQueue.Instance.Find(delegate(Transactie t)
         {
            if (t.Factuur.factuurid == factuurId) 
               return true;
            else
               return false;
         });

         if (transactie != null)
            TransactieQueue.Instance.Remove(transactie);
         return false;
      }
   }
}
